package com.cy.pj.sys.controller;

import com.cy.pj.common.pojo.JsonResult;
import com.cy.pj.sys.pojo.SysMenu;
import com.cy.pj.sys.service.Impl.MenuServiceImpl;
import com.cy.pj.sys.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ServiceMenuController {
    @Autowired
    private MenuServiceImpl menuService;
    @Autowired
    private RoleService roleService;

    @RequestMapping("menu/doFindObjects")
    public JsonResult findObjects() {
        return new JsonResult(menuService.findObjects());
    }

    @RequestMapping("menu/doFindZtreeMenuNodes")
    public JsonResult findZtreeMenuNodes() {
        return new JsonResult(menuService.findZtreeMenuNodes());
    }

    @RequestMapping("menu/doSaveObject")
    public JsonResult saveObject(SysMenu entity) {
        menuService.saveObject(entity);
        return new JsonResult("save ok");
    }

    @RequestMapping("menu/doUpdateObject")
    public JsonResult updateObject(SysMenu entity) {
        menuService.updateObject(entity);
        return new JsonResult("update ok");
    }

}
